//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: Transaction.cs
//
//  Description: Provides a save point object for MS SQL Server.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace Chili.Opf3.Storages.MsSql
{
	/// <summary>
	/// This class provides a save point for the <see cref="MsSqlStorage">MsSqlStorage</see> 
	/// class. It is returned by the <see cref="MsSqlTransaction.CreateSavePoint">MsSqlTransaction.CreateSavePoint</see>
	/// method and may be used in the <see cref="MsSqlTransaction.Rollback(MsSqlSavePoint)">MsSqlTransaction.Rollback</see> method.
	/// </summary>
	public sealed class MsSqlSavePoint
	{
		private string _name;
		private List<ObjectInfo> _objectInfos = new List<ObjectInfo>();

		/// <summary>
		/// Creates a new instance of the <see cref="MsSqlSavePoint">MsSqlSavePoint Class</see>.
		/// </summary>
		/// <param name="name">The name of the save point.</param>
		internal MsSqlSavePoint(string name)
		{
			if (name == null)
				throw new ArgumentNullException("name");

			_name = name;
		}

		/// <summary>
		/// Returns the list of changes <see cref="ObjectInfo">ObjectInfos</see>.
		/// </summary>
		internal List<ObjectInfo> ObjectInfos
		{
			get { return _objectInfos; }
		}

		/// <summary>
		/// Returns the name of the save point.
		/// </summary>
		public string Name
		{
			get { return _name; }
		}
	}
}
